home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-08 | 64.2 KB | 2,062 lines |
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/docs/MIRRORS samba-1.9.16alpha9/docs/MIRRORS
- --- samba-1.9.16alpha8/docs/MIRRORS Tue May 28 23:39:00 1996
- +++ samba-1.9.16alpha9/docs/MIRRORS Sat Jun 8 15:37:41 1996
- @@ -6,9 +6,9 @@
- ftp://nimbus.anu.edu.au/pub/tridge/samba
- ftp://sunsite.auc.dk/pub/unix/networking/samba/
- ftp://src.doc.ic.ac.uk/packages/samba/
- +ftp://choc.satech.net.au/pub/samba/
- ftp://ftp.warwick.ac.uk/pub/linux/sunsite.unc-mirror/system/Network/samba/
- ftp://sunsite.unc.edu/pub/Linux/system/Network/samba/
- -ftp://ftp.choc.apana.org.au/pub/samba/
- ftp://ftp.uni-trier.de/pub/unix/network/samba/
- ftp://ftp.spectrum.titan.com/pub/samba/
- ftp://ftp.demon.co.uk/pub/unix/unix/samba/
- @@ -28,4 +28,5 @@
- Http sites include:
-
- http://samba.canberra.edu.au/pub/samba
- -http://www.choc.apana.org.au/pub/samba
- +http://www.choc.satech.net.au/pub/samba/
- +
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/Makefile samba-1.9.16alpha9/source/Makefile
- --- samba-1.9.16alpha8/source/Makefile Thu Jun 6 21:57:20 1996
- +++ samba-1.9.16alpha9/source/Makefile Fri Jun 7 15:36:52 1996
- @@ -497,11 +497,11 @@
-
- UTILOBJ1 = util.o system.o charset.o kanji.o fault.o smbencrypt.o charcnv.o
- UTILOBJ2 = $(UTILOBJ1) md4.o loadparm.o params.o pcap.o username.o time.o
- -UTILOBJ = $(UTILOBJ2) interface.o
- +UTILOBJ = $(UTILOBJ2) interface.o
- PARAMOBJ = $(UTILOBJ) ufc.o smbpass.o access.o
- SMBDOBJ1 = $(PARAMOBJ) trans2.o message.o dir.o printing.o locking.o
- SMBDOBJ2 = ipc.o reply.o mangle.o chgpasswd.o password.o quotas.o uid.o
- -SMBDOBJ = $(SMBDOBJ1) $(SMBDOBJ2) $(VTP_OBJ)
- +SMBDOBJ = predict.o $(SMBDOBJ1) $(SMBDOBJ2) $(VTP_OBJ)
- NMBDOBJ1 = $(UTILOBJ) nmblib.o nameresp.o nmbsync.o nameannounce.o namedb.o nameelect.o
- NMBDOBJ = $(NMBDOBJ1) namework.o nameserv.o clientutil.o
- .SUFFIXES:
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/byteorder.h samba-1.9.16alpha9/source/byteorder.h
- --- samba-1.9.16alpha8/source/byteorder.h Sat May 4 17:50:23 1996
- +++ samba-1.9.16alpha9/source/byteorder.h Sat Jun 8 15:37:52 1996
- @@ -22,6 +22,70 @@
- /*
- This file implements macros for machine independent short and
- int manipulation
- +
- +Here is a description of this file that I emailed to the samba list once:
- +
- +> I am confused about the way that byteorder.h works in Samba. I have
- +> looked at it, and I would have thought that you might make a distinction
- +> between LE and BE machines, but you only seem to distinguish between 386
- +> and all other architectures.
- +>
- +> Can you give me a clue?
- +
- +sure.
- +
- +The distinction between 386 and other architectures is only there as
- +an optimisation. You can take it out completely and it will make no
- +difference. The routines (macros) in byteorder.h are totally byteorder
- +independent. The 386 optimsation just takes advantage of the fact that
- +the x86 processors don't care about alignment, so we don't have to
- +align ints on int boundaries etc. If there are other processors out
- +there that aren't alignment sensitive then you could also define
- +CAREFUL_ALIGNMENT=0 on those processors as well.
- +
- +Ok, now to the macros themselves. I'll take a simple example, say we
- +want to extract a 2 byte integer from a SMB packet and put it into a
- +type called uint16 that is in the local machines byte order, and you
- +want to do it with only the assumption that uint16 is _at_least_ 16
- +bits long (this last condition is very important for architectures
- +that don't have any int types that are 2 bytes long)
- +
- +You do this:
- +
- +#define CVAL(buf,pos) (((unsigned char *)(buf))[pos])
- +#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos))
- +#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8)
- +
- +then to extract a uint16 value at offset 25 in a buffer you do this:
- +
- +char *buffer = foo_bar();
- +uint16 xx = SVAL(buffer,25);
- +
- +We are using the byteoder independence of the ANSI C bitshifts to do
- +the work. A good optimising compiler should turn this into efficient
- +code, especially if it happens to have the right byteorder :-)
- +
- +I know these macros can be made a bit tidier by removing some of the
- +casts, but you need to look at byteorder.h as a whole to see the
- +reasoning behind them. byteorder.h defines the following macros:
- +
- +SVAL(buf,pos) - extract a 2 byte SMB value
- +IVAL(buf,pos) - extract a 4 byte SMB value
- +SVALS(buf,pos) signed version of SVAL()
- +IVALS(buf,pos) signed version of IVAL()
- +
- +SSVAL(buf,pos,val) - put a 2 byte SMB value into a buffer
- +SIVAL(buf,pos,val) - put a 4 byte SMB value into a buffer
- +SSVALS(buf,pos,val) - signed version of SSVAL()
- +SIVALS(buf,pos,val) - signed version of SIVAL()
- +
- +RSVAL(buf,pos) - like SVAL() but for NMB byte ordering
- +RIVAL(buf,pos) - like IVAL() but for NMB byte ordering
- +RSSVAL(buf,pos,val) - like SSVAL() but for NMB ordering
- +RSIVAL(buf,pos,val) - like SIVAL() but for NMB ordering
- +
- +it also defines lots of intermediate macros, just ignore those :-)
- +
- */
-
- #undef CAREFUL_ALIGNMENT
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/cvs.log samba-1.9.16alpha9/source/cvs.log
- --- samba-1.9.16alpha8/source/cvs.log Thu Jun 6 21:58:16 1996
- +++ samba-1.9.16alpha9/source/cvs.log Sat Jun 8 15:41:17 1996
- @@ -1291,3 +1291,171 @@
- Log Message:
- preparing for release of 1.9.16alpha8
-
- +
- +****************************************
- +Date: Friday June 7, 1996 @ 13:34
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv8181
- +
- +Modified Files:
- + Makefile interface.c loadparm.c loadparm.h namedb.c
- + nameelect.c nameserv.c namework.c nmbd.c nmbsync.c proto.h
- + util.c
- +Added Files:
- + predict.c
- +Log Message:
- +- added predict.c, moving the routines from util.c
- +
- +- added iface_count() and iface_n_ip() routines so its easy to loop
- +over the local interface list
- +
- +- made readsize a normal loadparm global
- +
- +- check for null w in add_domain_entry()
- +
- +- set the deathtime to time()-1 for doamin entries with servertype==0
- +This allows servers that are shutting down to be removed
- +
- +- add the 0x1c name at startup if we are a WINS server. Previously we
- +added it only if we were a master
- +
- +- loop over interfaces in add_my_domains(), so people don't have to
- +have a lmhosts file to get lp_workgroup() on all interfaces
- +
- +- set add to True for find_workgroupstruct() in nmbsync, and check for
- +null return
- +
- +- remove some ugly "errno = EBADF" bits. they just confused things.
- +
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 14:33
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv272
- +
- +Modified Files:
- + byteorder.h installscripts.sh interface.c nmblookup.c quotas.c
- +Log Message:
- +- added comments to byteorder.h explaining how it works.
- +- fixed problem with installscripts if srcdir is not set
- +- fixed ptr init bug in interface.c
- +- changed default lookup type in nmblookup to match nbtstat under NT
- +- new quotas fixes for sunos and solaris
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 14:34
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv323
- +
- +Modified Files:
- + nameannounce.c
- +Log Message:
- +patches fromk Luke putting in symbolic names for time constants
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 14:36
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv369
- +
- +Modified Files:
- + namedb.c
- +Log Message:
- +moved MSBROWSE into nameserv.h
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 14:40
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv477
- +
- +Modified Files:
- + nameelect.c nameserv.h nmbd.c
- +Log Message:
- +changes from Luke
- +
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 14:41
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv514
- +
- +Modified Files:
- + namework.c
- +Log Message:
- +changes from Luke
- +
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 15:36
- +Author: tridge
- +
- +Update of /data/cvs/samba/docs
- +In directory arvidsjaur:/var/tmp/cvs-serv1668
- +
- +Modified Files:
- + MIRRORS
- +Log Message:
- +fixed the apana MIRRORS entry
- +
- +
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 15:37
- +Author: tridge
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/var/tmp/cvs-serv1757
- +
- +Modified Files:
- + nameresp.c nameserv.c nmbd.c proto.h
- +Log Message:
- +more changes from Luke
- +
- +
- +
- +
- +
- +
- +
- +****************************************
- +Date: Saturday June 8, 1996 @ 15:38
- +Author: samba-bu
- +
- +Update of /data/cvs/samba/source
- +In directory arvidsjaur:/samba/samba-bugs/samba/source
- +
- +Modified Files:
- + version.h
- +Log Message:
- +preparing for release of 1.9.16alpha9
- +
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/installscripts.sh samba-1.9.16alpha9/source/installscripts.sh
- --- samba-1.9.16alpha8/source/installscripts.sh Thu May 30 13:15:57 1996
- +++ samba-1.9.16alpha9/source/installscripts.sh Sat Jun 8 15:37:52 1996
- @@ -16,8 +16,8 @@
- fi
- done
-
- -cp $SRCDIR/smbtar $BINDIR
- -cp $SRCDIR/addtosmbpass $BINDIR
- +cp ${SRCDIR}smbtar $BINDIR
- +cp ${SRCDIR}addtosmbpass $BINDIR
- echo Setting permissions on scripts
- chmod $INSTALLPERMS $BINDIR/smbtar
- chmod $INSTALLPERMS $BINDIR/addtosmbpass
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/interface.c samba-1.9.16alpha9/source/interface.c
- --- samba-1.9.16alpha8/source/interface.c Thu Jun 6 21:42:41 1996
- +++ samba-1.9.16alpha9/source/interface.c Sat Jun 8 15:37:52 1996
- @@ -25,6 +25,7 @@
- extern int DEBUGLEVEL;
-
- struct in_addr ipzero;
- +struct in_addr ipgrp;
- static struct in_addr default_ip;
- static struct in_addr default_bcast;
- static struct in_addr default_nmask;
- @@ -266,6 +267,7 @@
- struct in_addr ip;
-
- ipzero = *interpret_addr2("0.0.0.0");
- + ipgrp = *interpret_addr2("255.255.255.255");
-
- while (next_token(&ptr,token,NULL)) {
- /* parse it into an IP address/netmasklength pair */
- @@ -315,6 +317,8 @@
- iface = (struct interface *)malloc(sizeof(*iface));
- if (!iface) return;
-
- + iface->next = NULL;
- +
- if (got_ip) {
- iface->ip = default_ip;
- } else {
- @@ -386,6 +390,33 @@
- for (i=interfaces;i;i=i->next)
- if (ip_equal(i->bcast,bcast)) return True;
- return False;
- +}
- +
- +/****************************************************************************
- + how many interfaces do we have
- + **************************************************************************/
- +int iface_count(void)
- +{
- + int ret = 0;
- + struct interface *i;
- +
- + for (i=interfaces;i;i=i->next)
- + ret++;
- + return ret;
- +}
- +
- +/****************************************************************************
- + return IP of the Nth interface
- + **************************************************************************/
- +struct in_addr *iface_n_ip(int n)
- +{
- + struct interface *i;
- +
- + for (i=interfaces;i && n;i=i->next)
- + n--;
- +
- + if (i) return &i->ip;
- + return NULL;
- }
-
- static struct interface *iface_find(struct in_addr ip)
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/loadparm.c samba-1.9.16alpha9/source/loadparm.c
- --- samba-1.9.16alpha8/source/loadparm.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/loadparm.c Fri Jun 7 15:36:53 1996
- @@ -56,7 +56,6 @@
- BOOL bLoaded = False;
-
- extern int DEBUGLEVEL;
- -extern int ReadSize;
- extern pstring user_socket_options;
-
- #ifndef GLOBAL_NAME
- @@ -149,6 +148,7 @@
- int syslog;
- int os_level;
- int max_ttl;
- + int ReadSize;
- BOOL bWINSsupport;
- BOOL bWINSproxy;
- BOOL bPreferredMaster;
- @@ -409,7 +409,7 @@
- {"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL},
- {"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL},
- {"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL},
- - {"read size", P_INTEGER, P_GLOBAL, &ReadSize, NULL},
- + {"read size", P_INTEGER, P_GLOBAL, &Globals.ReadSize, NULL},
- #ifdef KANJI
- {"coding system", P_INTEGER, P_GLOBAL, &coding_system, handle_coding_system},
- #endif /* KANJI */
- @@ -582,6 +582,7 @@
- Globals.bBrowseList = True;
- Globals.bWINSsupport = True;
- Globals.bWINSproxy = False;
- + Globals.ReadSize = 16*1024;
-
- #ifdef KANJI
- coding_system = interpret_coding_system (KANJI, SJIS_CODE);
- @@ -735,6 +736,7 @@
- FN_GLOBAL_INTEGER(lp_maxpacket,&Globals.max_packet)
- FN_GLOBAL_INTEGER(lp_keepalive,&keepalive)
- FN_GLOBAL_INTEGER(lp_passwordlevel,&Globals.pwordlevel)
- +FN_GLOBAL_INTEGER(lp_readsize,&Globals.ReadSize)
- FN_GLOBAL_INTEGER(lp_deadtime,&Globals.deadtime)
- FN_GLOBAL_INTEGER(lp_maxprotocol,&Globals.maxprotocol)
- FN_GLOBAL_INTEGER(lp_security,&Globals.security)
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/loadparm.h samba-1.9.16alpha9/source/loadparm.h
- --- samba-1.9.16alpha8/source/loadparm.h Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/loadparm.h Fri Jun 7 15:36:53 1996
- @@ -93,6 +93,7 @@
- extern int lp_lpqcachetime(void);
- extern int lp_syslog(void);
- extern int lp_deadtime(void);
- +extern int lp_readsize(void);
- extern int lp_debuglevel(void);
- extern int lp_maxprotocol(void);
- extern int lp_maxpacket(void);
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nameannounce.c samba-1.9.16alpha9/source/nameannounce.c
- --- samba-1.9.16alpha8/source/nameannounce.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/nameannounce.c Sat Jun 8 15:37:52 1996
- @@ -51,7 +51,6 @@
-
- /* what server type are we currently */
-
- -#define MSBROWSE "\001\002__MSBROWSE__\002"
- #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE"
-
- /****************************************************************************
- @@ -124,7 +123,7 @@
- int tok;
-
- if (!lastrun) lastrun = t;
- - if (t < lastrun + 1*60) return;
- + if (t < lastrun + CHECK_TIME_ANNOUNCE_BACKUP * 60) return;
- lastrun = t;
-
- for (tok = 0; tok <= workgroup_count; tok++)
- @@ -215,7 +214,8 @@
- if (work->needannounce) {
- /* drop back to a max 3 minute announce - this is to prevent a
- single lost packet from stuffing things up for too long */
- - work->announce_interval = MIN(work->announce_interval,3*60);
- + work->announce_interval = MIN(work->announce_interval,
- + CHECK_TIME_MIN_HOST_ANNCE*60);
- work->lastannounce_time = t - (work->announce_interval+1);
- }
-
- @@ -224,7 +224,7 @@
- (t - work->lastannounce_time) < work->announce_interval)
- continue;
-
- - if (work->announce_interval < 12*60)
- + if (work->announce_interval < CHECK_TIME_MAX_HOST_ANNCE * 60)
- work->announce_interval += 60;
-
- work->lastannounce_time = t;
- @@ -343,11 +343,8 @@
- time_t t = time(NULL);
- BOOL am_master = False; /* are we a master of some sort? :-) */
-
- -#ifdef TEST_CODE
- - if (last && (t-last < 2*60)) return;
- -#else
- - if (last && (t-last < 15*60)) return;
- -#endif
- + if (last && (t-last < CHECK_TIME_MST_ANNOUNCE * 60))
- + return;
-
- last = t;
-
- @@ -425,7 +422,7 @@
- ip = *interpret_addr2(lp_domain_controller());
-
- if (zero_ip(ip)) {
- - ip = *iface_bcast(d->bcast_ip);
- + ip = d->bcast_ip;
- bcast = True;
- }
-
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/namedb.c samba-1.9.16alpha9/source/namedb.c
- --- samba-1.9.16alpha8/source/namedb.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/namedb.c Sat Jun 8 15:37:53 1996
- @@ -38,6 +38,8 @@
- extern pstring myname;
- extern pstring scope;
-
- +extern struct in_addr ipgrp;
- +
- /* this is our browse master/backup cache database */
- struct browse_cache_record *browserlist = NULL;
-
- @@ -55,9 +57,6 @@
- SV_TYPE_TIME_SOURCE | SV_TYPE_SERVER_UNIX | \
- SV_TYPE_PRINTQ_SERVER | SV_TYPE_POTENTIAL_BROWSER)
-
- -/* here are my election parameters */
- -#define MSBROWSE "\001\002__MSBROWSE__\002"
- -
-
- /****************************************************************************
- add a workgroup into the domain list
- @@ -449,7 +448,7 @@
- struct domain_record *d;
- struct in_addr ip;
-
- - ip = *interpret_addr2("255.255.255.255");
- + ip = ipgrp;
-
- if (zero_ip(source_ip))
- source_ip = *iface_bcast(source_ip);
- @@ -460,6 +459,8 @@
- {
- struct work_record *w = find_workgroupstruct(d, name, add);
-
- + if (!w) return NULL;
- +
- /* add WORKGROUP(1e) and WORKGROUP(00) entries into name database
- or register with WINS server, if it's our workgroup */
- if (strequal(lp_workgroup(), name))
- @@ -586,7 +587,8 @@
- if (ismybcast(d->bcast_ip) &&
- strequal(lp_workgroup(),work->work_group))
- {
- - servertype |= SV_TYPE_LOCAL_LIST_ONLY;
- + if (servertype)
- + servertype |= SV_TYPE_LOCAL_LIST_ONLY;
- }
- else
- {
- @@ -599,6 +601,9 @@
- strupper(s->serv.name);
- s->serv.type = servertype;
- s->death_time = ttl?time(NULL)+ttl*3:0;
- +
- + if (servertype == 0)
- + s->death_time = time(NULL)-1;
-
- /* for a domain entry, the comment field refers to the server name */
-
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nameelect.c samba-1.9.16alpha9/source/nameelect.c
- --- samba-1.9.16alpha8/source/nameelect.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/nameelect.c Sat Jun 8 15:37:53 1996
- @@ -45,7 +45,6 @@
-
- #define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER)
-
- -#define MSBROWSE "\001\002__MSBROWSE__\002"
- #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE"
-
- extern struct domain_record *domainlist;
- @@ -61,7 +60,9 @@
- struct domain_record *d;
-
- if (!lastrun) lastrun = t;
- - if (t < lastrun + 5*60) return;
- + if (t < lastrun + CHECK_TIME_MST_BROWSE * 60)
- + return;
- +
- lastrun = t;
-
- dump_workgroups();
- @@ -108,16 +109,16 @@
- }
- else
- {
- - DEBUG(2,("no master browser for persistent entry %s %s\n",
- - work->work_group, inet_ntoa(d->bcast_ip)));
- + /* XXXX note: this will delete entries that have been added in by
- + lmhosts as well. a flag to ensure that these are not deleted may
- + be considered */
- +
- + /* workgroup with no master browser is not the default workgroup:
- + it's also not on our subnet. therefore delete it: it can be
- + recreated dynamically */
-
- - /* XXXX oh dear. we are going to have problems here. the
- - entry is a persistent one, there isn't anyone responsible
- - for this workgroup up and running, yet we can't find it
- - and we are going to continually have name_queries until
- - a master browser is found for this workgroup on the
- - remote subnet.
- - */
- + send_election(d, work->work_group, 0, 0, myname);
- + remove_workgroup(d, work);
- }
- }
-
- @@ -177,9 +178,7 @@
- DEBUG(4,("Domain master: adding names...\n"));
-
- /* add domain master and domain member names or register with WINS */
- - add_name_entry(work->work_group,0x1b,NB_ACTIVE );
- - add_name_entry(work->work_group,0x1c,NB_ACTIVE|NB_GROUP);
- -
- + add_name_entry(work->work_group,0x1b,NB_ACTIVE);
- work->ServerType |= SV_TYPE_DOMAIN_MASTER;
-
- if (lp_domain_logons())
- @@ -215,7 +214,6 @@
- work->ElectionCriterion &= ~0x4;
-
- remove_name_entry(work->work_group,0x1b);
- - remove_name_entry(work->work_group,0x1c);
- remove_name_entry(work->work_group,0x1d);
- remove_name_entry(MSBROWSE ,0x01);
- }
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nameresp.c samba-1.9.16alpha9/source/nameresp.c
- --- samba-1.9.16alpha8/source/nameresp.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/nameresp.c Sat Jun 8 15:37:53 1996
- @@ -103,9 +103,9 @@
- /****************************************************************************
- reply to a netbios name packet
- ****************************************************************************/
- -void reply_netbios_packet(struct packet_struct *p1,int trn_id,int rcode,int opcode,
- - struct nmb_name *rr_name,int rr_type,int rr_class,int ttl,
- - char *data,int len)
- +void reply_netbios_packet(struct packet_struct *p1,int trn_id,int rcode,
- + int opcode,BOOL recurse,struct nmb_name *rr_name,
- + int rr_type,int rr_class,int ttl,char *data,int len)
- {
- struct packet_struct p;
- struct nmb_packet *nmb = &p.packet.nmb;
- @@ -126,7 +126,7 @@
- nmb->header.opcode = opcode;
- nmb->header.response = True;
- nmb->header.nm_flags.bcast = False;
- - nmb->header.nm_flags.recursion_available = True;
- + nmb->header.nm_flags.recursion_available = recurse;
- nmb->header.nm_flags.recursion_desired = True;
- nmb->header.nm_flags.trunc = False;
- nmb->header.nm_flags.authoritative = True;
- @@ -275,11 +275,9 @@
- /****************************************************************************
- create a name query response record
- **************************************************************************/
- -static struct name_response_record *make_name_query_record(
- - enum cmd_type cmd,int id,int fd,
- - char *name,int type,
- - BOOL bcast,BOOL recurse,
- - struct in_addr ip)
- +static struct name_response_record *
- +make_name_query_record(enum cmd_type cmd,int id,int fd,char *name,int type,
- + BOOL bcast,BOOL recurse,struct in_addr ip)
- {
- struct name_response_record *n;
-
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nameserv.c samba-1.9.16alpha9/source/nameserv.c
- --- samba-1.9.16alpha8/source/nameserv.c Thu Jun 6 21:57:21 1996
- +++ samba-1.9.16alpha9/source/nameserv.c Sat Jun 8 15:37:53 1996
- @@ -31,14 +31,13 @@
- extern int ClientNMB;
- extern int ClientDGRAM;
-
- -enum name_search { FIND_SELF, FIND_GLOBAL };
- -
- extern int DEBUGLEVEL;
-
- extern pstring scope;
- extern BOOL CanRecurse;
- extern pstring myname;
- extern struct in_addr ipzero;
- +extern struct in_addr ipgrp;
-
- /* netbios names database */
- struct name_record *namelist;
- @@ -96,6 +95,7 @@
- }
- }
-
- +
- /****************************************************************************
- find a name in the domain database namelist
- search can be:
- @@ -103,28 +103,19 @@
- FIND_GLOBAL - the name can be anyone. first look on the client's
- subnet, then the server's subnet, then all subnets.
- **************************************************************************/
- -static struct name_record *find_name_search(struct nmb_name *name,
- +static struct name_record *find_name_search(struct nmb_name *name,
- enum name_search search,
- struct in_addr ip)
- {
- struct name_record *ret;
-
- - /* any number of winpopup names can be added. must search by ip as
- - well */
- - if (name->name_type != 0x3) ip = ipzero;
- -
- for (ret = namelist; ret; ret = ret->next)
- {
- - if (name_equal(&ret->name,name))
- - {
- - /* self search: self names only */
- - if (search == FIND_SELF && ret->source != SELF) continue;
- -
- - if (zero_ip(ip) || ip_equal(ip, ret->ip))
- - {
- - return ret;
- - }
- - }
- + if (!name_equal(&ret->name,name)) continue;
- +
- + if (search == FIND_SELF && ret->source != SELF) continue;
- +
- + return ret;
- }
-
- return NULL;
- @@ -267,8 +258,31 @@
- add_netbios_entry("*",0x0,NB_ACTIVE,0,SELF,ip,False);
- add_netbios_entry("__SAMBA__",0x20,NB_ACTIVE,0,SELF,ip,False);
- add_netbios_entry("__SAMBA__",0x00,NB_ACTIVE,0,SELF,ip,False);
- +
- + if (lp_wins_support()) {
- + /* the 0x1c name gets added by any WINS server it seems */
- + add_name_entry(my_workgroup(),0x1c,NB_ACTIVE|NB_GROUP);
- + }
- +}
- +
- +/****************************************************************************
- + remove all the samba names... from a WINS server if necessary.
- + **************************************************************************/
- +void remove_my_names()
- +{
- + struct name_record *n;
- +
- + for (n = namelist; n; n = n->next)
- + {
- + if (n->source == SELF)
- + {
- + /* get all SELF names removed from the WINS server's database */
- + remove_name_entry(n->name.name, n->name.name_type);
- + }
- + }
- }
-
- +
- /*******************************************************************
- refresh my own names
- ******************************************************************/
- @@ -316,8 +330,8 @@
-
-
- /****************************************************************************
- -response for a reg release received
- -**************************************************************************/
- + response for a reg release received
- + **************************************************************************/
- void response_name_release(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- @@ -345,8 +359,8 @@
-
-
- /****************************************************************************
- -reply to a name release
- -****************************************************************************/
- + reply to a name release
- + ****************************************************************************/
- void reply_name_release(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- @@ -361,12 +375,12 @@
- putip((char *)&ip,&nmb->additional->rdata[2]);
-
- DEBUG(3,("Name release on name %s rcode=%d\n",
- - namestr(&nmb->question.question_name),rcode));
- + namestr(&nmb->question.question_name),rcode));
-
- n = find_name_search(&nmb->question.question_name, FIND_GLOBAL, ip);
-
- /* XXXX under what conditions should we reject the removal?? */
- - if (n && n->nb_flags == nb_flags && ip_equal(n->ip,ip))
- + if (n && n->nb_flags == nb_flags)
- {
- /* success = True;
- rcode = 6; */
- @@ -377,27 +391,24 @@
-
- if (bcast) return;
-
- - /*if (success)*/
- - {
- - rdata[0] = nb_flags;
- - rdata[1] = 0;
- - putip(&rdata[2],(char *)&ip);
- - }
- + rdata[0] = nb_flags;
- + rdata[1] = 0;
- + putip(&rdata[2],(char *)&ip);
-
- /* Send a NAME RELEASE RESPONSE */
- - reply_netbios_packet(p,nmb->header.name_trn_id,rcode,opcode,
- + reply_netbios_packet(p,nmb->header.name_trn_id,
- + rcode,opcode,True,
- &nmb->question.question_name,
- nmb->question.question_type,
- nmb->question.question_class,
- 0,
- - rdata, 6 /*success ? 6 : 0*/);
- - /* XXXX reject packet never tested: cannot tell what to do */
- + rdata, 6);
- }
-
-
- /****************************************************************************
- -response for a reg request received
- -**************************************************************************/
- + response for a reg request received
- + **************************************************************************/
- void response_name_reg(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- @@ -428,38 +439,45 @@
-
-
- /****************************************************************************
- -reply to a reg request
- -**************************************************************************/
- + reply to a reg request
- + **************************************************************************/
- void reply_name_reg(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- struct nmb_name *question = &nmb->question.question_name;
- - char *qname = nmb->question.question_name.name;
- - int name_type = nmb->question.question_name.name_type;
- +
- + struct nmb_name *reply_name = question;
- + char *qname = question->name;
- + int name_type = question->name_type;
- + int name_class = nmb->question.question_class;
-
- BOOL bcast = nmb->header.nm_flags.bcast;
-
- int ttl = GET_TTL(nmb->additional->ttl);
- int nb_flags = nmb->additional->rdata[0];
- - BOOL group = (nb_flags&0x80);
- + BOOL group = NAME_GROUP(nb_flags);
- int rcode = 0;
- int opcode = nmb->header.opcode;
- +
- struct name_record *n = NULL;
- - int success = True;
- + BOOL success = True;
- + BOOL recurse = True; /* true if samba replies yes/no: false if caller */
- + /* must challenge the current owner */
- char rdata[6];
- - struct in_addr ip, from_ip;
-
- - putip((char *)&from_ip,&nmb->additional->rdata[2]);
- - ip = from_ip;
- + struct in_addr ip, from_ip;
-
- DEBUG(3,("Name registration for name %s at %s rcode=%d\n",
- namestr(question),inet_ntoa(ip),rcode));
-
- + putip((char *)&from_ip,&nmb->additional->rdata[2]);
- + ip = from_ip;
- +
- if (group)
- {
- /* apparently we should return 255.255.255.255 for group queries
- (email from MS) */
- - ip = *interpret_addr2("255.255.255.255");
- + ip = ipgrp;
- }
-
- /* see if the name already exists */
- @@ -467,19 +485,62 @@
-
- if (n)
- {
- - if (!group && !ip_equal(ip,n->ip) && question->name_type != 0x3)
- + if (!group) /* unique names */
- {
- - if (n->source == SELF)
- + if (n->source == SELF || NAME_GROUP(n->nb_flags))
- {
- + /* no-one can register one of samba's names, nor can they
- + register a name that's a group name as a unique name */
- +
- rcode = 6;
- success = False;
- }
- + else if(!ip_equal(ip, n->ip))
- + {
- + /* hm. this unique name doesn't belong to them. */
- +
- + /* XXXX rfc1001.txt says:
- + * if we are doing secured WINS, we must send a Wait-Acknowledge
- + * packet (WACK) to the person who wants the name, then do a
- + * name query on the person who currently owns the unique name.
- + * if the current owner is alive, the person who wants the name
- + * can't have it. if they are not alive, they can.
- + *
- + * if we are doing non-secure WINS (which is much simpler) then
- + * we send a message to the person wanting the name saying 'he
- + * owns this name: i don't want to hear from you ever again
- + * until you've checked with him if you can have it!'. we then
- + * abandon the registration. once the person wanting the name
- + * has checked with the current owner, they will repeat the
- + * registration packet if the current owner is dead or doesn't
- + * want the name.
- + */
- +
- + /* non-secured WINS implementation: caller is responsible
- + for checking with current owner of name, then getting back
- + to us... IF current owner no longer owns the unique name */
- +
- + rcode = 0;
- + success = False;
- + recurse = False;
- +
- + /* we inform on the current owner to the caller (which is
- + why it's non-secure */
- +
- + reply_name = &n->name;
- +
- + /* name_type = ?;
- + name_class = ?;
- + XXXX sorry, guys: i really can't see what name_type
- + and name_class should be set to according to rfc1001 */
- + }
- else
- {
- + /* XXXX removed code that checked with the owner of a name */
- +
- n->ip = ip;
- n->death_time = ttl?p->timestamp+ttl*3:0;
- - DEBUG(3,("%s changed owner to %s\n",
- - namestr(&n->name),inet_ntoa(n->ip)));
- + DEBUG(3,("%s owner: %s\n",namestr(&n->name),inet_ntoa(n->ip)));
- }
- }
- else
- @@ -494,81 +555,59 @@
- else
- {
- /* add the name to our subnet/name database */
- - n = add_netbios_entry(qname,name_type,nb_flags,ttl,REGISTER,ip,False);
- + n = add_netbios_entry(qname,name_type,nb_flags,ttl,REGISTER,ip,True);
- }
-
- if (bcast) return;
-
- - update_from_reg(nmb->question.question_name.name,
- - nmb->question.question_name.name_type, from_ip);
- -
- - /* XXXX don't know how to reject a name register: stick info in anyway
- - and guess that it doesn't matter if info is there! */
- - /*if (success)*/
- - {
- - rdata[0] = nb_flags;
- - rdata[1] = 0;
- - putip(&rdata[2],(char *)&ip);
- - }
- + if (success)
- + {
- + update_from_reg(nmb->question.question_name.name,
- + nmb->question.question_name.name_type, from_ip);
- + }
-
- - /* Send a NAME REGISTRATION RESPONSE */
- - reply_netbios_packet(p,nmb->header.name_trn_id,rcode,opcode,
- - &nmb->question.question_name,
- - nmb->question.question_type,
- - nmb->question.question_class,
- + rdata[0] = nb_flags;
- + rdata[1] = 0;
- + putip(&rdata[2],(char *)&ip);
- +
- + /* Send a NAME REGISTRATION RESPONSE (pos/neg)
- + or and END-NODE CHALLENGE REGISTRATION RESPONSE */
- + reply_netbios_packet(p,nmb->header.name_trn_id,
- + rcode,opcode,recurse,
- + reply_name, name_type, name_class,
- ttl,
- - rdata, 6 /*success ? 6 : 0*/);
- + rdata, 6);
- }
-
-
- /****************************************************************************
- -reply to a name status query
- -****************************************************************************/
- + reply to a name status query
- + ****************************************************************************/
- void reply_name_status(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- char *qname = nmb->question.question_name.name;
- int ques_type = nmb->question.question_name.name_type;
- - BOOL wildcard = (qname[0] == '*');
- char rdata[MAX_DGRAM_SIZE];
- - char *countptr, *buf;
- - int count, names_added;
- + char *countptr, *buf, *bufend;
- + int names_added;
- struct name_record *n;
-
- DEBUG(3,("Name status for name %s %s\n",
- - namestr(&nmb->question.question_name), inet_ntoa(p->ip)));
- + namestr(&nmb->question.question_name), inet_ntoa(p->ip)));
-
- - /* find a name: if it's a wildcard, search the entire database.
- - if not, search for source SELF names only */
- - n = find_name_search(&nmb->question.question_name,
- - wildcard ? FIND_GLOBAL : FIND_SELF, p->ip);
- -
- - if (!wildcard && (!n || n->source != SELF)) return;
- -
- - for (count=0, n = namelist ; n; n = n->next)
- - {
- - int name_type = n->name.name_type;
- -
- - if (n->source != SELF) continue;
- -
- - if (name_type >= 0x1b && name_type <= 0x20 &&
- - ques_type >= 0x1b && ques_type <= 0x20)
- - {
- - if (!strequal(qname, n->name.name)) continue;
- - }
- -
- - count++;
- - }
- + n = find_name_search(&nmb->question.question_name,FIND_GLOBAL, p->ip);
-
- + if (!n) return;
- +
- /* XXXX hack, we should calculate exactly how many will fit */
- - count = MIN(count,(sizeof(rdata) - 64) / 18);
- -
- + bufend = &rdata[MAX_DGRAM_SIZE] - 18;
- countptr = buf = rdata;
- buf += 1;
-
- names_added = 0;
-
- - for (n = namelist ; n && count >= 0; n = n->next)
- + for (n = namelist ; n && buf < bufend; n = n->next)
- {
- int name_type = n->name.name_type;
-
- @@ -577,7 +616,7 @@
- /* start with first bit of putting info in buffer: the name */
-
- bzero(buf,18);
- - StrnCpy(buf,n->name.name,15);
- + sprintf(buf,"%-15.15s",n->name.name);
- strupper(buf);
-
- /* now check if we want to exclude other workgroup names
- @@ -597,15 +636,9 @@
-
- buf += 18;
-
- - count--;
- names_added++;
- }
- -
- - if (count < 0)
- - {
- - DEBUG(3, (("too many names: missing a few!\n")));
- - }
- -
- +
- SCVAL(countptr,0,names_added);
-
- /* XXXXXXX we should fill in more fields of the statistics structure */
- @@ -621,7 +654,8 @@
- buf += 64;
-
- /* Send a POSITIVE NAME STATUS RESPONSE */
- - reply_netbios_packet(p,nmb->header.name_trn_id,0,0,
- + reply_netbios_packet(p,nmb->header.name_trn_id,
- + 0,0,True,
- &nmb->question.question_name,
- nmb->question.question_type,
- nmb->question.question_class,
- @@ -631,10 +665,11 @@
-
-
- /***************************************************************************
- -reply to a name query
- -****************************************************************************/
- -struct name_record *search_for_name(struct nmb_name *question,
- - struct in_addr ip, int Time, int search)
- + reply to a name query
- + ****************************************************************************/
- +static struct name_record *search_for_name(struct nmb_name *question,
- + struct in_addr ip, int Time,
- + enum name_search search)
- {
- int name_type = question->name_type;
- char *qname = question->name;
- @@ -644,7 +679,7 @@
-
- DEBUG(3,("Search for %s from %s - ", namestr(question), inet_ntoa(ip)));
-
- - /* first look up name in cache */
- + /* first look up name in cache. use ip as well as name to locate it */
- n = find_name_search(question,search,ip);
-
- /* now try DNS lookup. */
- @@ -670,14 +705,12 @@
- /* no luck with DNS. We could possibly recurse here XXXX */
- /* if this isn't a bcast then we should send a negative reply XXXX */
- DEBUG(3,("no recursion\n"));
- - add_netbios_entry(qname,name_type,NB_ACTIVE,60*60,DNSFAIL,
- - dns_ip,False);
- + add_netbios_entry(qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip,True);
- return NULL;
- }
-
- /* add it to our cache of names. give it 2 hours in the cache */
- - n = add_netbios_entry(qname,name_type,NB_ACTIVE,2*60*60,DNS,
- - dns_ip,False);
- + n = add_netbios_entry(qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip,True);
-
- /* failed to add it? yikes! */
- if (!n) return NULL;
- @@ -702,45 +735,25 @@
- }
-
-
- -/***************************************************************************
- -reply to a name query.
- -
- -with broadcast name queries:
- -
- - - only reply if the query is for one of YOUR names. all other machines on
- - the network will be doing the same thing (that is, only replying to a
- - broadcast query if they own it)
- - NOTE: broadcast name queries should only be sent out by a machine
- - if they HAVEN'T been configured to use WINS. this is generally bad news
- - in a wide area tcp/ip network and should be rectified by the systems
- - administrator. USE WINS! :-)
- - - the exception to this is if the query is for a Primary Domain Controller
- - type name (0x1b), in which case, a reply is sent.
-
- - - NEVER send a negative response to a broadcast query. no-one else will!
- -
- -with directed name queries:
- -
- - - if you are the WINS server, you are expected to
- -****************************************************************************/
- -extern void reply_name_query(struct packet_struct *p)
- +/***************************************************************************
- + reply to a name query
- + ****************************************************************************/
- +void reply_name_query(struct packet_struct *p)
- {
- struct nmb_packet *nmb = &p->packet.nmb;
- struct nmb_name *question = &nmb->question.question_name;
- int name_type = question->name_type;
- - BOOL dns_type = name_type == 0x20 || name_type == 0;
- + BOOL dns_type = name_type == 0x20 || name_type == 0;
- BOOL bcast = nmb->header.nm_flags.bcast;
- int ttl=0;
- int rcode = 0;
- int nb_flags = 0;
- struct in_addr retip;
- char rdata[6];
- -
- - struct in_addr gp_ip = *interpret_addr2("255.255.255.255");
- BOOL success = True;
- -
- struct name_record *n;
- - enum name_search search = dns_type || name_type == 0x1b ?
- + enum name_search search = (dns_type || name_type == 0x1b) ?
- FIND_GLOBAL : FIND_SELF;
-
- DEBUG(3,("Name query "));
- @@ -756,8 +769,8 @@
- return;
- }
- }
- -
- - /* we will reply */
- +
- + /* name is directed query, or it's self, or it's a PDC type name */
- ttl = n->death_time - p->timestamp;
- retip = n->ip;
- nb_flags = n->nb_flags;
- @@ -767,13 +780,10 @@
- if (bcast) return; /* never reply negative response to bcasts */
- success = False;
- }
- -
- - /* if asking for a group name (type 0x1e) return 255.255.255.255 */
- - if (ip_equal(retip, gp_ip) && name_type == 0x1e) retip = gp_ip;
-
- /* if the IP is 0 then substitute my IP */
- if (zero_ip(retip)) retip = *iface_ip(p->ip);
- -
- +
- if (success)
- {
- rcode = 0;
- @@ -792,13 +802,15 @@
- putip(&rdata[2],(char *)&retip);
- }
-
- - reply_netbios_packet(p,nmb->header.name_trn_id,rcode,0,
- + reply_netbios_packet(p,nmb->header.name_trn_id,
- + rcode,0,True,
- &nmb->question.question_name,
- nmb->question.question_type,
- nmb->question.question_class,
- ttl,
- rdata, success ? 6 : 0);
- }
- +
-
-
- /****************************************************************************
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nameserv.h samba-1.9.16alpha9/source/nameserv.h
- --- samba-1.9.16alpha8/source/nameserv.h Thu Jun 6 01:44:17 1996
- +++ samba-1.9.16alpha9/source/nameserv.h Sat Jun 8 15:37:53 1996
- @@ -56,6 +56,9 @@
- #define NAME_MFLAG(p) (((p) & NB_FLGMSK) == NB_MFLAG)
- #define NAME__FLAG(p) (((p) & NB_FLGMSK) == NB__FLAG)
-
- +#define MSBROWSE "\001\002__MSBROWSE__\002"
- +
- +enum name_search { FIND_SELF, FIND_GLOBAL };
- enum name_source {STATUS_QUERY, LMHOSTS, REGISTER, SELF, DNS, DNSFAIL};
- enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3};
- enum packet_type {NMB_PACKET, DGRAM_PACKET};
- @@ -260,14 +263,32 @@
- #define AM_DOMCTL(work) (work->ServerType & SV_TYPE_DOMAIN_CTRL)
-
-
- -#define ANN_HostAnnouncement 1
- -#define ANN_AnnouncementRequest 2
- -#define ANN_Election 8
- -#define ANN_GetBackupListReq 9
- -#define ANN_GetBackupListResp 10
- -#define ANN_BecomeBackup 11
- -#define ANN_DomainAnnouncement 12
- -#define ANN_MasterAnnouncement 13
- -#define ANN_ResetBrowserState 14
- +/* ids for netbios packet types */
- +#define ANN_HostAnnouncement 1
- +#define ANN_AnnouncementRequest 2
- +#define ANN_Election 8
- +#define ANN_GetBackupListReq 9
- +#define ANN_GetBackupListResp 10
- +#define ANN_BecomeBackup 11
- +#define ANN_DomainAnnouncement 12
- +#define ANN_MasterAnnouncement 13
- +#define ANN_ResetBrowserState 14
- #define ANN_LocalMasterAnnouncement 15
- +
- +
- +/* broadcast packet announcement intervals, in minutes */
- +
- +/* search for master browsers of workgroups samba knows about,
- + except default */
- +#define CHECK_TIME_MST_BROWSE 5
- +
- +/* request backup browser announcements from other servers */
- +#define CHECK_TIME_ANNOUNCE_BACKUP 15
- +
- +/* request host announcements from other servers: min and max of interval */
- +#define CHECK_TIME_MIN_HOST_ANNCE 3
- +#define CHECK_TIME_MAX_HOST_ANNCE 12
- +
- +/* announce as master to WINS server and any Primary Domain Controllers */
- +#define CHECK_TIME_MST_ANNOUNCE 15
-
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/namework.c samba-1.9.16alpha9/source/namework.c
- --- samba-1.9.16alpha8/source/namework.c Thu Jun 6 21:57:22 1996
- +++ samba-1.9.16alpha9/source/namework.c Sat Jun 8 15:37:54 1996
- @@ -71,7 +71,6 @@
- #define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER)
- #define AM_BACKUP(work) (work->ServerType & SV_TYPE_BACKUP_BROWSER)
-
- -#define MSBROWSE "\001\002__MSBROWSE__\002"
- #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE"
-
- #define GET_TTL(ttl) ((ttl)?MIN(ttl,lp_max_ttl()):lp_max_ttl())
- @@ -270,16 +269,19 @@
- /****************************************************************************
- add the default workgroup into my domain
- **************************************************************************/
- -void add_my_domains(void)
- +void add_my_domains(char *group)
- {
- - /* add or find domain on our local subnet, in the default workgroup */
- -
- - if (*lp_workgroup() != '*')
- - {
- - add_domain_entry(*iface_bcast(ipzero),
- - *iface_nmask(ipzero),
- - lp_workgroup(), True);
- - }
- + int n,i;
- + struct in_addr *ip;
- +
- + if (*group == '*') return;
- +
- + n = iface_count();
- + for (i=0;i<n;i++) {
- + ip = iface_n_ip(i);
- + if (!ip) return;
- + add_domain_entry(*iface_bcast(*ip),*iface_nmask(*ip),lp_workgroup(),True);
- + }
- }
-
-
- @@ -649,7 +651,7 @@
- {
- struct dgram_packet *dgram = &p->packet.dgram;
- struct in_addr ip = dgram->header.source_ip;
- - struct domain_record *d; /* = find_domain(ip); */
- + struct domain_record *d;
- struct work_record *work;
-
- int count = CVAL(buf,0);
- @@ -728,7 +730,7 @@
- struct work_record *work;
- for (work=d->workgrouplist;work;work=remove_workgroup(d,work));
- }
- - add_my_domains();
- + add_my_domains(lp_workgroup());
- }
-
- /* stop browsing altogether. i don't think this is a good idea! */
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nmbd.c samba-1.9.16alpha9/source/nmbd.c
- --- samba-1.9.16alpha8/source/nmbd.c Thu Jun 6 21:57:22 1996
- +++ samba-1.9.16alpha9/source/nmbd.c Sat Jun 8 15:37:54 1996
- @@ -55,6 +55,28 @@
- extern struct in_addr ipzero;
-
-
- + /****************************************************************************
- +catch a sigterm
- +****************************************************************************/
- +static int sig_term()
- +{
- + BlockSignals(True);
- +
- + DEBUG(0,("Got SIGTERM: going down...\n"));
- +
- + dump_names();
- + reload_services(True);
- +
- + /* remove all samba names, with wins server if necessary. */
- + remove_my_names();
- +
- + /* XXXX don't care if we never receive a response back... yet */
- + /* XXXX other things: if we are a master browser, force an election? */
- +
- + exit(0);
- +}
- +
- +
- /****************************************************************************
- catch a sighup
- ****************************************************************************/
- @@ -267,7 +289,7 @@
- if (group) {
- add_domain_entry(ipaddr, ipmask, name, True);
- } else {
- - add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr,False);
- + add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr,True);
- }
- }
- }
- @@ -426,8 +448,9 @@
- fault_setup(fault_continue);
-
- signal(SIGHUP,SIGNAL_CAST sig_hup);
- + signal(SIGTERM,SIGNAL_CAST sig_term);
-
- - while ((opt = getopt (argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:")) != EOF)
- + while ((opt = getopt(argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:")) != EOF)
- {
- switch (opt)
- {
- @@ -492,7 +515,7 @@
- return(-1);
-
- if (*group)
- - add_domain_entry(*iface_bcast(ipzero),*iface_nmask(ipzero),group, True);
- + add_my_domains(group);
-
- if (!is_daemon && !is_a_socket(0)) {
- DEBUG(0,("standard input is not a socket, assuming -D option\n"));
- @@ -519,7 +542,7 @@
- string_sub(ServerComment,"%h",myhostname);
-
- add_my_names();
- - add_my_domains();
- + add_my_domains(lp_workgroup());
-
- DEBUG(3,("Checked names\n"));
-
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nmblookup.c samba-1.9.16alpha9/source/nmblookup.c
- --- samba-1.9.16alpha8/source/nmblookup.c Thu Jun 6 21:57:23 1996
- +++ samba-1.9.16alpha9/source/nmblookup.c Sat Jun 8 15:37:54 1996
- @@ -93,7 +93,7 @@
- int main(int argc,char *argv[])
- {
- int opt;
- - unsigned int lookup_type = 0x20;
- + unsigned int lookup_type = 0;
- pstring lookup;
- extern int optind;
- extern char *optarg;
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/nmbsync.c samba-1.9.16alpha9/source/nmbsync.c
- --- samba-1.9.16alpha8/source/nmbsync.c Thu Jun 6 21:57:23 1996
- +++ samba-1.9.16alpha9/source/nmbsync.c Fri Jun 7 15:36:53 1996
- @@ -103,7 +103,6 @@
- uint32 stype = IVAL(p,18);
- int comment_offset = IVAL(p,22) & 0xFFFF;
- char *cmnt = comment_offset?(rdata+comment_offset-converter):"";
- -
- struct work_record *w = work;
-
- DEBUG(4, ("\t%-16.16s %08x %s\n", sname, stype, cmnt));
- @@ -111,16 +110,17 @@
- if (stype & SV_TYPE_DOMAIN_ENUM)
- {
- /* creates workgroup on remote subnet */
- - if ((w = find_workgroupstruct(d,sname, False)))
- + if ((w = find_workgroupstruct(d,sname, True)))
- {
- if (ismybcast(d->bcast_ip))
- {
- announce_request(w, d->bcast_ip);
- }
- }
- - }
- + }
-
- - add_server_entry(d,w,sname,stype,lp_max_ttl(),cmnt,False);
- + if (w)
- + add_server_entry(d,w,sname,stype,lp_max_ttl(),cmnt,False);
- }
- }
- }
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/predict.c samba-1.9.16alpha9/source/predict.c
- --- samba-1.9.16alpha8/source/predict.c Thu Jan 1 10:00:00 1970
- +++ samba-1.9.16alpha9/source/predict.c Fri Jun 7 13:33:59 1996
- @@ -0,0 +1,146 @@
- +/*
- + Unix SMB/Netbios implementation.
- + Version 1.9.
- + file read prediction routines
- + Copyright (C) Andrew Tridgell 1992-1995
- +
- + This program is free software; you can redistribute it and/or modify
- + it under the terms of the GNU General Public License as published by
- + the Free Software Foundation; either version 2 of the License, or
- + (at your option) any later version.
- +
- + This program is distributed in the hope that it will be useful,
- + but WITHOUT ANY WARRANTY; without even the implied warranty of
- + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + GNU General Public License for more details.
- +
- + You should have received a copy of the GNU General Public License
- + along with this program; if not, write to the Free Software
- + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- +*/
- +
- +#include "includes.h"
- +#include "loadparm.h"
- +
- +extern int DEBUGLEVEL;
- +
- +
- +/* variables used by the read prediction module */
- +static int rp_fd = -1;
- +static int rp_offset = 0;
- +static int rp_length = 0;
- +static int rp_alloced = 0;
- +static int rp_predict_fd = -1;
- +static int rp_predict_offset = 0;
- +static int rp_predict_length = 0;
- +static int rp_timeout = 5;
- +static time_t rp_time = 0;
- +static char *rp_buffer = NULL;
- +static BOOL predict_skip=False;
- +time_t smb_last_time=(time_t)0;
- +
- +/****************************************************************************
- +handle read prediction on a file
- +****************************************************************************/
- +int read_predict(int fd,int offset,char *buf,char **ptr,int num)
- +{
- + int ret = 0;
- + int possible = rp_length - (offset - rp_offset);
- +
- + possible = MIN(possible,num);
- +
- + /* give data if possible */
- + if (fd == rp_fd &&
- + offset >= rp_offset &&
- + possible>0 &&
- + smb_last_time-rp_time < rp_timeout)
- + {
- + ret = possible;
- + if (buf)
- + memcpy(buf,rp_buffer + (offset-rp_offset),possible);
- + else
- + *ptr = rp_buffer + (offset-rp_offset);
- + DEBUG(5,("read-prediction gave %d bytes of %d\n",ret,num));
- + }
- +
- + if (ret == num) {
- + predict_skip = True;
- + } else {
- + predict_skip = False;
- +
- + /* prepare the next prediction */
- + rp_predict_fd = fd;
- + rp_predict_offset = offset + num;
- + rp_predict_length = num;
- + }
- +
- + if (ret < 0) ret = 0;
- +
- + return(ret);
- +}
- +
- +/****************************************************************************
- +pre-read some data
- +****************************************************************************/
- +void do_read_prediction()
- +{
- + static int readsize = 0;
- +
- + if (predict_skip) return;
- +
- + if (rp_predict_fd == -1)
- + return;
- +
- + rp_fd = rp_predict_fd;
- + rp_offset = rp_predict_offset;
- + rp_length = 0;
- +
- + rp_predict_fd = -1;
- +
- + if (readsize == 0) {
- + readsize = lp_readsize();
- + readsize = MAX(readsize,1024);
- + }
- +
- + rp_predict_length = MIN(rp_predict_length,2*readsize);
- + rp_predict_length = MAX(rp_predict_length,1024);
- + rp_offset = (rp_offset/1024)*1024;
- + rp_predict_length = (rp_predict_length/1024)*1024;
- +
- + if (rp_predict_length > rp_alloced)
- + {
- + rp_buffer = Realloc(rp_buffer,rp_predict_length);
- + rp_alloced = rp_predict_length;
- + if (!rp_buffer)
- + {
- + DEBUG(0,("can't allocate read-prediction buffer\n"));
- + rp_predict_fd = -1;
- + rp_fd = -1;
- + rp_alloced = 0;
- + return;
- + }
- + }
- +
- + if (lseek(rp_fd,rp_offset,SEEK_SET) != rp_offset) {
- + rp_fd = -1;
- + rp_predict_fd = -1;
- + return;
- + }
- +
- + rp_length = read(rp_fd,rp_buffer,rp_predict_length);
- + rp_time = time(NULL);
- + if (rp_length < 0)
- + rp_length = 0;
- +}
- +
- +/****************************************************************************
- +invalidate read-prediction on a fd
- +****************************************************************************/
- +void invalidate_read_prediction(int fd)
- +{
- + if (rp_fd == fd)
- + rp_fd = -1;
- + if (rp_predict_fd == fd)
- + rp_predict_fd = -1;
- +}
- +
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/proto.h samba-1.9.16alpha9/source/proto.h
- --- samba-1.9.16alpha8/source/proto.h Thu Jun 6 21:57:24 1996
- +++ samba-1.9.16alpha9/source/proto.h Sat Jun 8 15:37:54 1996
- @@ -67,6 +67,8 @@
- void iface_set_default(char *ip,char *bcast,char *nmask);
- BOOL ismyip(struct in_addr ip);
- BOOL ismybcast(struct in_addr bcast);
- +int iface_count(void);
- +struct in_addr *iface_n_ip(int n);
- struct in_addr *iface_bcast(struct in_addr ip);
- struct in_addr *iface_nmask(struct in_addr ip);
- struct in_addr *iface_ip(struct in_addr ip);
- @@ -147,9 +149,9 @@
- BOOL bcast,BOOL recurse,
- struct in_addr to_ip, struct in_addr *ip,void (*fn)());
- void expire_netbios_response_entries(time_t t);
- -void reply_netbios_packet(struct packet_struct *p1,int trn_id,int rcode,int opcode,
- - struct nmb_name *rr_name,int rr_type,int rr_class,int ttl,
- - char *data,int len);
- +void reply_netbios_packet(struct packet_struct *p1,int trn_id,int rcode,
- + int opcode,BOOL recurse,struct nmb_name *rr_name,
- + int rr_type,int rr_class,int ttl,char *data,int len);
- uint16 initiate_netbios_packet(int fd,int quest_type,char *name,int name_type,
- int nb_flags,BOOL bcast,BOOL recurse,
- struct in_addr to_ip);
- @@ -180,6 +182,7 @@
- void remove_name_entry(char *name,int type);
- void add_name_entry(char *name,int type,int nb_flags);
- void add_my_names(void);
- +void remove_my_names();
- void refresh_my_names(time_t t);
- void expire_names(time_t t);
- void response_name_release(struct packet_struct *p);
- @@ -187,8 +190,7 @@
- void response_name_reg(struct packet_struct *p);
- void reply_name_reg(struct packet_struct *p);
- void reply_name_status(struct packet_struct *p);
- -struct name_record *search_for_name(struct nmb_name *question,
- - struct in_addr ip, int Time, int search);
- +void reply_name_query(struct packet_struct *p);
- void process_nmb(struct packet_struct *p);
- void reset_server(char *name, int state, struct in_addr ip);
- void tell_become_backup(void);
- @@ -197,7 +199,7 @@
- int name_type,
- struct in_addr ip);
- void update_from_reg(char *name, int type, struct in_addr ip);
- -void add_my_domains(void);
- +void add_my_domains(char *group);
- BOOL same_context(struct dgram_packet *dgram);
- BOOL listening_name(struct work_record *work, struct nmb_name *n);
- void process_logon_packet(struct packet_struct *p,char *buf,int len);
- @@ -239,12 +241,19 @@
- BOOL server_validate(char *buf);
- BOOL pcap_printername_ok(char *pszPrintername, char *pszPrintcapname);
- void pcap_printer_fn(void (*fn)());
- +int read_predict(int fd,int offset,char *buf,char **ptr,int num);
- +void do_read_prediction();
- +void invalidate_read_prediction(int fd);
- void lpq_reset(int snum);
- void print_file(int fnum);
- int get_printqueue(int snum,int cnum,print_queue_struct **queue,
- print_status_struct *status);
- void del_printqueue(int cnum,int snum,int jobid);
- void status_printjob(int cnum,int snum,int jobid,int status);
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize);
- int reply_special(char *inbuf,char *outbuf);
- int reply_tcon(char *inbuf,char *outbuf);
- int reply_tcon_and_X(char *inbuf,char *outbuf,int length,int bufsize);
- @@ -457,9 +466,6 @@
- BOOL send_keepalive(int client);
- int read_data(int fd,char *buffer,int N);
- int write_data(int fd,char *buffer,int N);
- -int read_predict(int fd,int offset,char *buf,char **ptr,int num);
- -void do_read_prediction();
- -void invalidate_read_prediction(int fd);
- int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align);
- int read_smb_length(int fd,char *inbuf,int timeout);
- BOOL receive_smb(int fd,char *buffer,int timeout);
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/quotas.c samba-1.9.16alpha9/source/quotas.c
- --- samba-1.9.16alpha8/source/quotas.c Wed Jun 5 01:16:28 1996
- +++ samba-1.9.16alpha9/source/quotas.c Sat Jun 8 15:37:54 1996
- @@ -29,6 +29,7 @@
-
- #include "includes.h"
-
- +extern int DEBUGLEVEL;
-
- #ifdef LINUX
-
- @@ -50,7 +51,7 @@
- */
- #include "quota/quotactl.c"
- #include "quota/hasquota.c"
- -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- {
- uid_t euser_id;
- struct dqblk D;
- @@ -139,7 +140,7 @@
- /****************************************************************************
- try to get the disk space from disk quotas (CRAY VERSION)
- ****************************************************************************/
- -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- {
- struct mntent *mnt;
- FILE *fd;
- @@ -233,48 +234,119 @@
- }
-
-
- -#elif defined(SUNOS5)
- +#elif defined(SUNOS5) || defined(SUNOS4)
-
- -#include <devnm.h>
- #include <fcntl.h>
- +#if defined(SUNOS5)
- #include <sys/fs/ufs_quota.h>
- +#include <sys/mnttab.h>
- +#else /* defined(SUNOS4) */
- +#include <ufs/quota.h>
- +#include <mntent.h>
- +#endif
-
- /****************************************************************************
- try to get the disk space from disk quotas (solaris 2 version)
- ****************************************************************************/
- /* Quota code by Peter Urbanec (amiga@cse.unsw.edu.au) */
- -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- {
- uid_t user_id, euser_id;
- - int r;
- + int ret;
- struct dqblk D;
- +#if defined(SUNOS5)
- struct quotctl command;
- int file;
- - int ret;
- -
- - if((file=open(path, O_RDONLY))<0) return(False);
- + struct mnttab mnt;
- + static char name[MNT_LINE_MAX] ;
- +#else
- + struct mntent *mnt;
- + static char name[MNTMAXSTR] ;
- +#endif
- + FILE *fd;
- + struct stat sbuf;
- + dev_t devno ;
- + static dev_t devno_cached = 0 ;
- + int found ;
- +
- + if ( stat(path,&sbuf) == -1 )
- + return(False) ;
- +
- + devno = sbuf.st_dev ;
- +DEBUG(5,("disk_quotas: looking for path \"%s\" devno=%o\n", path,devno));
- + if ( devno != devno_cached ) {
- + devno_cached = devno ;
- +#if defined(SUNOS5)
- + if ((fd = fopen(MNTTAB, "r")) == NULL)
- + return(False) ;
- +
- + found = False ;
- + while (getmntent(fd, &mnt) == 0) {
- + if ( stat(mnt.mnt_mountp,&sbuf) == -1 )
- + continue ;
- +DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", mnt.mnt_mountp,sbuf.st_dev));
- + if (sbuf.st_dev == devno) {
- + found = True ;
- + break ;
- + }
- + }
- +
- + strcpy(name,mnt.mnt_mountp) ;
- + strcat(name,"/quotas") ;
- + fclose(fd) ;
- +#else
- + if ((fd = setmntent(MOUNTED, "r")) == NULL)
- + return(False) ;
- +
- + found = False ;
- + while ((mnt = getmntent(fd)) != NULL) {
- + if ( stat(mnt->mnt_dir,&sbuf) == -1 )
- + continue ;
- +DEBUG(5,("disk_quotas: testing \"%s\" devno=%o\n", mnt->mnt_dir,sbuf.st_dev));
- + if (sbuf.st_dev == devno) {
- + found = True ;
- + break ;
- + }
- + }
- +
- + strcpy(name,mnt->mnt_fsname) ;
- + endmntent(fd) ;
- +#endif
- +
- + if ( ! found )
- + return(False) ;
- + }
-
- euser_id = geteuid();
- user_id = getuid();
-
- - command.op = Q_GETQUOTA;
- - command.uid = euser_id;
- - command.addr = (caddr_t) &D;
- -
- setuid(0); /* Solaris seems to want to give info only to super-user */
- seteuid(0);
-
- +#if defined(SUNOS5)
- +DEBUG(5,("disk_quotas: looking for quotas file \"%s\"\n", name));
- + if((file=open(name, O_RDONLY))<0) {
- + setuid(user_id); /* Restore the original UID status */
- + seteuid(euser_id);
- + return(False);
- + }
- + command.op = Q_GETQUOTA;
- + command.uid = euser_id;
- + command.addr = (caddr_t) &D;
- ret = ioctl(file, Q_QUOTACTL, &command);
- + close(file);
- +#else
- +DEBUG(5,("disk_quotas: trying quotactl on device \"%s\"\n", name));
- + ret = quotactl(Q_GETQUOTA, name, euser_id, &D);
- +#endif
-
- setuid(user_id); /* Restore the original UID status */
- seteuid(euser_id);
-
- if (ret < 0) {
- - close(file);
- DEBUG(2,("disk_quotas ioctl (Solaris) failed\n"));
- return(False);
- }
- - close(file);
-
-
- /* Use softlimit to determine disk space. A user exceeding the quota is told
- @@ -283,6 +355,8 @@
- * made of rubber latex and begins to expand to accommodate the user :-)
- */
-
- + if (D.dqb_bsoftlimit==0)
- + return(False);
- *bsize = 512;
- *dfree = D.dqb_bsoftlimit - D.dqb_curblocks;
- *dsize = D.dqb_bsoftlimit;
- @@ -306,7 +380,7 @@
- /****************************************************************************
- try to get the disk space from disk quotas - default version
- ****************************************************************************/
- -static BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- +BOOL disk_quotas(char *path, int *bsize, int *dfree, int *dsize)
- {
- uid_t user_id, euser_id;
- int r;
- @@ -341,6 +415,8 @@
- }
- else return(False);
- }
- + if (D.dqb_bsoftlimit==0)
- + return(False);
- /* Use softlimit to determine disk space, except when it has been exceeded */
- if ((D.dqb_curblocks>D.dqb_bsoftlimit)||(D.dqb_curfiles>D.dqb_fsoftlimit))
- {
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/util.c samba-1.9.16alpha9/source/util.c
- --- samba-1.9.16alpha8/source/util.c Thu Jun 6 21:57:24 1996
- +++ samba-1.9.16alpha9/source/util.c Fri Jun 7 15:36:55 1996
- @@ -56,10 +56,6 @@
- */
- int case_default = CASE_LOWER;
-
- -
- -/* size of reads during a direct file to file transfer */
- -int ReadSize = 16*1024;
- -
- pstring debugf = "/tmp/log.samba";
- int syslog_level;
-
- @@ -1951,7 +1947,6 @@
-
- /* Check if error */
- if(selrtn == -1) {
- - errno = EBADF;
- return -1;
- }
-
- @@ -1974,7 +1969,6 @@
- /* force a particular error number for
- portability */
- DEBUG(5,("read gave error %s\n",strerror(errno)));
- - errno = EBADF;
- return -1;
- }
-
- @@ -2068,10 +2062,6 @@
- {
- ret = read(fd,buffer + total,N - total);
-
- - /* this is for portability */
- - if (ret < 0)
- - errno = EBADF;
- -
- if (ret <= 0)
- return total;
- total += ret;
- @@ -2101,142 +2091,28 @@
- }
-
-
- -/* variables used by the read prediction module */
- -int rp_fd = -1;
- -int rp_offset = 0;
- -int rp_length = 0;
- -int rp_alloced = 0;
- -int rp_predict_fd = -1;
- -int rp_predict_offset = 0;
- -int rp_predict_length = 0;
- -int rp_timeout = 5;
- -time_t rp_time = 0;
- -char *rp_buffer = NULL;
- -BOOL predict_skip=False;
- -time_t smb_last_time=(time_t)0;
- -
- -/****************************************************************************
- -handle read prediction on a file
- -****************************************************************************/
- -int read_predict(int fd,int offset,char *buf,char **ptr,int num)
- -{
- - int ret = 0;
- - int possible = rp_length - (offset - rp_offset);
- -
- - possible = MIN(possible,num);
- -
- - /* give data if possible */
- - if (fd == rp_fd &&
- - offset >= rp_offset &&
- - possible>0 &&
- - smb_last_time-rp_time < rp_timeout)
- - {
- - ret = possible;
- - if (buf)
- - memcpy(buf,rp_buffer + (offset-rp_offset),possible);
- - else
- - *ptr = rp_buffer + (offset-rp_offset);
- - DEBUG(5,("read-prediction gave %d bytes of %d\n",ret,num));
- - }
- -
- - if (ret == num) {
- - predict_skip = True;
- - } else {
- - predict_skip = False;
- -
- - /* prepare the next prediction */
- - rp_predict_fd = fd;
- - rp_predict_offset = offset + num;
- - rp_predict_length = num;
- - }
- -
- - if (ret < 0) ret = 0;
- -
- - return(ret);
- -}
- -
- -/****************************************************************************
- -pre-read some data
- -****************************************************************************/
- -void do_read_prediction()
- -{
- - if (predict_skip) return;
- -
- - if (rp_predict_fd == -1)
- - return;
- -
- - rp_fd = rp_predict_fd;
- - rp_offset = rp_predict_offset;
- - rp_length = 0;
- -
- - rp_predict_fd = -1;
- -
- - rp_predict_length = MIN(rp_predict_length,2*ReadSize);
- - rp_predict_length = MAX(rp_predict_length,1024);
- - rp_offset = (rp_offset/1024)*1024;
- - rp_predict_length = (rp_predict_length/1024)*1024;
- -
- - if (rp_predict_length > rp_alloced)
- - {
- - rp_buffer = Realloc(rp_buffer,rp_predict_length);
- - rp_alloced = rp_predict_length;
- - if (!rp_buffer)
- - {
- - DEBUG(0,("can't allocate read-prediction buffer\n"));
- - rp_predict_fd = -1;
- - rp_fd = -1;
- - rp_alloced = 0;
- - return;
- - }
- - }
- -
- - if (lseek(rp_fd,rp_offset,SEEK_SET) != rp_offset) {
- - rp_fd = -1;
- - rp_predict_fd = -1;
- - return;
- - }
- -
- - rp_length = read(rp_fd,rp_buffer,rp_predict_length);
- - rp_time = time(NULL);
- - if (rp_length < 0)
- - rp_length = 0;
- -}
- -
- -/****************************************************************************
- -invalidate read-prediction on a fd
- -****************************************************************************/
- -void invalidate_read_prediction(int fd)
- -{
- - if (rp_fd == fd)
- - rp_fd = -1;
- - if (rp_predict_fd == fd)
- - rp_predict_fd = -1;
- -}
- -
- -
- /****************************************************************************
- transfer some data between two fd's
- ****************************************************************************/
- int transfer_file(int infd,int outfd,int n,char *header,int headlen,int align)
- {
- static char *buf=NULL;
- + static int size=0;
- char *buf1,*abuf;
- - static int size = 0;
- int total = 0;
-
- DEBUG(4,("transfer_file %d (head=%d) called\n",n,headlen));
-
- - if ((size < ReadSize) && buf) {
- - free(buf);
- - buf = NULL;
- + if (size == 0) {
- + size = lp_readsize();
- + size = MAX(size,1024);
- }
-
- - size = MAX(ReadSize,1024);
- -
- while (!buf && size>0) {
- buf = (char *)Realloc(buf,size+8);
- if (!buf) size /= 2;
- }
- +
- if (!buf) {
- DEBUG(0,("Can't allocate transfer buffer!\n"));
- exit(1);
- diff -u -r --new-file --exclude=CVS samba-1.9.16alpha8/source/version.h samba-1.9.16alpha9/source/version.h
- --- samba-1.9.16alpha8/source/version.h Thu Jun 6 21:57:49 1996
- +++ samba-1.9.16alpha9/source/version.h Sat Jun 8 15:38:39 1996
- @@ -1 +1 @@
- -#define VERSION "1.9.16alpha8"
- +#define VERSION "1.9.16alpha9"
-